<template>
  <el-table
    :data="tableData"
    stripe
    style="width: 100%">
    <el-table-column
      type="index"
      width="50">
    </el-table-column>
    <el-table-column
      prop="roofPlacement"
      label="置顶"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="文章标题"
      width="120">
    </el-table-column>
    <el-table-column
      prop="categories"
      label="文章类别"
      width="120">
    </el-table-column>
    <el-table-column
      prop="date"
      label="创建时间"
      width="150">
    </el-table-column>
    <el-table-column
      prop="enable"
      label="显示"
      width="120">
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      min-width="100">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
        <el-button @click="handleDelete(scope.row)" type="text" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    data() {
      return {
        tableData: [{
          id:1,
          date: '2016-05-02',
          name: '华通银行创建时间',
          province: '上海',
          categories: '公告',
          enable: '是'
        }, {
          id:2,
          date: '2016-05-04',
          name: '王小虎',
          province: '上海',
          categories: '新闻',
          enable: '是'
        }]
      }
    },
    methods: {
      handleClick(row) {
        // console.log(row.id)
        // this.$router.push({ 
        //   // path: `/addContent/${row.id}`,
        //   // path: "/addContent",
        //   // qurey:{id:1}
        //   path: "/addContent",
        //   // params:{id:1}
        // });
        window.s_id=row.id
        this.$router.push("/addContent");
        // this.$router.push("/editContent/" + rowData._id);
      },
      handleDelete(index) {
       let data= this.tableData.splice(index, 1);
       console.log(data[0].id)
      }
    },
  }
</script>

<style>

</style>
